home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
cspelsrc.zip
/
CSPELLA.C
< prev
next >
Wrap
Text File
|
1987-12-09
|
49KB
|
2,320 lines
/* PROGRAM dumb.C */
/* by Peter A. Banks */
/* Home phone 481-8242 */
/* Work Phone 568-4855 */
/* Compiled under Turbo C (tcc) */
/* linked with Microsoft linker */
/* Turbo's linker did not work */
#include "stdio.h"
#include "io.h"
#include "alloc.h"
#include "conio.h"
#include "ctype.h"
#include "stdlib.h"
#include "dir.h"
#include "string.h"
#include "DOS.H"
#include "limits.h"
#include "stddef.h"
#define NO_DEBUG
#define LINELIM 255 /* maX NUMBER
CHARACTERS PER LINE */
#define WORDSTAR 0
#define SEDT_PTP 144
#define MAXWRD 20
#define MAXLINE 255
#define CRET 13
#define DEL 127
#define PERIOD 46
#define BCKSP 8
#define COLON 58
#define SLASH 47
#define BCKSLSH 92
#define HYPHEN 45
/* Globals varables define */
int video = 0;
int wrrd = 0;
int totwrd; /* TOTAL WORDS */
int mspwrd; /* miss-spelled words */
int result; /* RESULT OF FOPEN */
int letcnt = 0; /* LETTER COUNT OF WORD */
int hyphcnt = 0; /* LETTER COUNT OF WORD */
int perdex = 0; /* pointer of personal dictionary */
int lnlength = 0; /* length of line */
long int memaval;
char *path ;
char *drive;
char *dirr ;
char *nam ;
char *ext ;
char srcline [MAXLINE];
char wordtex[MAXWRD] = ""; /* word extracted from source line */
char hyphtex[MAXWRD] = ""; /* word extracted from source line with hyphen */
char srchtx[MAXWRD]; /* word extracted from source line */
char srchtex[MAXWRD]; /* word extracted from source line */
char *dctenv = NULL;
char *chrpnt = NULL;
char outln [MAXLINE];
char perdctt = 1;
unsigned char hyphen = 0;
unsigned char hyphen1 = 0;
unsigned char hyphen2 = 0;
unsigned char marker = SEDT_PTP;
char *srcdir = NULL;
char fylnam [60];
char tmmpnam [60];
char perdctnam [60];
char *tmpnam;
char *tmpfyl;
FILE *source;
FILE *perdct;
FILE *output;
FILE *temp;
/* dictionaries defined */
#define THREELN 478
extern char threedct [THREELN] [4];
int threesiz = THREELN;
#define FOURLN 1439
extern char fourdct [FOURLN] [5];
#define FIVELN 1968
extern char fivedct [FIVELN] [6];
#define SIXLN 2378
extern char sixdct [SIXLN] [7];
#define SEVNLN 2382
extern char sevndct [SEVNLN] [8];
#define EIGHTLN 2013
extern char eightdct [EIGHTLN] [9];
#define NINELN 1807
extern char ninedct [NINELN] [10];
#define TENLN 1331
extern char tendct [TENLN] [11];
#define ELEVENLN 943
extern char elevendct [ELEVENLN] [12];
#define TWELVELN 529
extern char twelvedct [TWELVELN] [13];
#define T3TENLN 347
extern char t3tendct [T3TENLN] [14];
#define FORTENLN 156
extern char fortendct [FORTENLN] [15];
#define FIVTENLN 74
extern char fivtendct [FIVTENLN] [16];
#define SIXTENLN 42
extern char sixtendct [SIXTENLN] [17];
#define SEVTENLN 18
extern char sevtendct [SEVTENLN] [18];
#define EITENLN 4
extern char eitendct [EITENLN] [19];
int persize;
extern char personaldct [1500] [21];
int collums;
int page;
int mode;
#ifdef TIMER
struct time st_time;
struct time end_time;
struct time tot_time;
#endif TIMER
union REGS reg;
void GOTOXY(x,y)
int x,y;
{
#ifdef CLONE
reg.h.ah = 2;
reg.h.bh = page;
reg.h.dl = x;
reg.h.dh = y;
int86(0x10,®,®);
#endif CLONE
#ifdef RAINBOW
cprintf("\033[%1d;%1df",y,x);
#endif RAINBOW
}
void selpage(page)
int page;
{
reg.h.ah = 5;
reg.h.al = 131;
reg.h.bh = page;
reg.h.bl = 01;
int86(0x10,®,®);
}
int getmode()
{
reg.h.ah = 15;
reg.h.al = 0;
reg.h.bh = 0;
reg.h.bl = 0;
int86(0x10,®,®);
mode = reg.h.al;
page = reg.h.bh;
collums = reg.h.ah;
#ifdef DEBUG
printf("%d active page %d mode %d collums",page,mode,collums);
getche();
#endif DEBUG
}
void CLRSCRN()
{
#ifdef CLONE
reg.h.ah = 6;
reg.h.al = 25;
reg.h.bh = 7;
reg.h.ch = 0;
reg.h.cl = 0;
reg.h.dl = 79;
reg.h.dh = 25;
int86(0x10,®,®);
#endif CLONE
#ifdef RAINBOW
cprintf("\033[2J");
#endif RAINBOW
GOTOXY(0,0);
}
#ifdef CLONE
void scrolup(x)
int x;
{
reg.h.ah = 6;
reg.h.al = x;
reg.h.bh = 7;
reg.h.ch = 6;
reg.h.cl = 0;
reg.h.dl = 79;
reg.h.dh = 20;
int86(0x10,®,®);
GOTOXY(00,19);
}
#endif CLONE
#ifdef CLONE
void scroldwn(x)
int x;
{
GOTOXY(30,22);
reg.h.ah = 7;
reg.h.al = x;
reg.h.bh = 7;
reg.h.ch = 22;
reg.h.cl = 30;
reg.h.dl = 60;
reg.h.dh = 25;
int86(0x10,®,®);
}
#endif CLONE
char *getpath(filnm)
char filnm [60];
{
char *dirr;
char *ptr;
int lnlgth;
int indx;
lnlgth = strlen(filnm);
while ((filnm[lnlgth] != COLON) && (filnm[lnlgth] != SLASH) && (filnm[lnlgth] != BCKSLSH))
lnlgth--;
if (coreleft())
dirr = malloc (61);
ptr = dirr;
for(indx = 0; indx <=lnlgth; indx++)
{
*ptr = filnm[indx];
ptr++;
}
if(filnm [indx-1] == COLON)
{
*ptr = SLASH;
ptr++;
}
*ptr = 0;
return(dirr);
}
void dumpdic()
{
char buf;
int totdic = 0;
register int index = 0;
#ifdef RAINBOW
GOTOXY(00,19);
#endif RAINBOW
while (index < THREELN)
{
totdic++;
#ifdef CLONE
scrolup (1);
cprintf ("%d %s %d ",index,threedct [index],totdic );
#endif CLONE
#ifdef RAINBOW
cprintf ("%d %s %d \n\r",index,threedct [index],totdic);
#endif RAINBOW
index++;
}
index = 0;
while (index < FOURLN)
{
totdic++;
#ifdef CLONE
scrolup (1);
cprintf ("%d %s %d ",index,fourdct [index], totdic);
#endif CLONE
#ifdef RAINBOW
cprintf ("%d %s %d \n\r ",index,fourdct [index], totdic);
#endif RAINBOW
index++;
}
index = 0;
while (index < FIVELN)
{
totdic++;
#ifdef CLONE
scrolup (1);
cprintf ("%d %s %d ",index,fivedct [index],totdic );
#endif CLONE
#ifdef RAINBOW
cprintf ("%d %s %d \n\r",index,fivedct [index],totdic );
#endif
index++;
}
index = 0;
while (index < SIXLN)
{
totdic++;
#ifdef CLONE
scrolup (1);
cprintf ("%d %s %d ",index,sixdct [index],totdic );
#endif CLONE
#ifdef RAINBOW
cprintf ("%d %s %d \n\r",index,sixdct [index],totdic );
#endif RAINBOW
index++;
}
index = 0;
while (index < SEVNLN)
{
totdic++;
#ifdef CLONE
scrolup (1);
cprintf ("%d %s %d ",index,sevndct [index],totdic );
#endif CLONE
#ifdef RAINBOW
cprintf ("%d %s %d \n\r",index,sevndct [index],totdic );
#endif RAINBOW
index++;
}
index = 0;
while (index < EIGHTLN)
{
totdic++;
#ifdef CLONE
scrolup (1);
cprintf ("%d %s %d ",index,eightdct [index],totdic );
#endif CLONE
#ifdef RAINBOW
cprintf ("%d %s %d \n\r",index,eightdct [index],totdic );
#endif RAINBOW
index++;
}
index = 0;
while (index < NINELN)
{
totdic++;
#ifdef CLONE
scrolup (1);
cprintf ("%d %s %d ",index,ninedct [index],totdic );
#endif CLONE
#ifdef RAINBOW
cprintf ("%d %s %d \n\r",index,ninedct [index],totdic );
#endif RAINBOW
index++;
}
index = 0;
while (index < TENLN)
{
totdic++;
#ifdef CLONE
scrolup (1);
cprintf ("%d %s %d ",index,tendct [index],totdic );
#endif CLONE
#ifdef RAINBOW
cprintf ("%d %s %d \n\r",index,tendct [index],totdic );
#endif RAINBOW
ind